ARTESCA-15250 Handle stacked bars#835
Conversation
Add logic to sum values for stacked bars to get maxValue Add test and story
Hello jeanmarcmilletscality,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
6e8cde5 to
d95d57c
Compare
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for stacked bars by summing segment values to compute the maximum, sorting series by average when stacked, and wiring the stacked prop through the component, including a Storybook entry and tests.
- Renamed
getMaxValuetogetMaxBarValueand implemented summation for stacked items. - Updated
formatPrometheusDataToChartDatato sort bar series by their average whenstackedis true. - Extended
Barchartcomponent to accept astackedprop, applystackId, and added a new Story and tests for stacking.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| stories/BarChart/barchart.stories.tsx | Added Stacked story with sample stacked data |
| src/lib/components/barchartv2/utils.ts | Replaced getMaxValue with getMaxBarValue and added stacked logic and sorting |
| src/lib/components/barchartv2/utils.test.ts | Updated tests for getMaxBarValue and added stacked bar sorting tests |
| src/lib/components/barchartv2/Barchart.component.tsx | Integrated stacked prop into chart rendering and added stackId |
| src/lib/components/barchartv2/Barchart.component.test.tsx | Added a test to verify stacked bar rendering |
Comments suppressed due to low confidence (3)
src/lib/components/barchartv2/utils.ts:38
- [nitpick] The variable name
filterOutCategorysuggests a boolean but holds an array of keys; consider renaming it tononCategoryKeysorcategoryKeysfor clarity.
const filterOutCategory = Object.keys(item).filter(
src/lib/components/barchartv2/Barchart.component.test.tsx:233
- This test only verifies category labels but doesn’t confirm that bars are actually stacked (e.g., checking
stackIdon each bar or correct rendering order). Consider adding assertions to validate stacking behavior.
it('should render stacked bars', () => {
src/lib/components/barchartv2/utils.ts:152
- [nitpick] The logic to derive
dataKeyfromlabelis duplicated in multiple places; extracting it into a shared helper would improve maintainability and reduce duplication.
dataKey: bar.label.toLowerCase().replace(/\s+/g, ''),
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
|
/approve |
|
I have successfully merged the changeset of this pull request
Please check the status of the associated issue ARTESCA-15250. Goodbye jeanmarcmilletscality. The following options are set: approve |
Add logic to sum values for stacked bars to get maxValue
Add test and story
Next Step : Add a sorting callback function